//
//  RoadTransportEmptyListView.m
//  NtoccDriverNew
//
//  Created by 张天兴 on 2025/9/24.
//  Copyright © 2025 GCY. All rights reserved.
//

#import "RoadTransportEmptyListView.h"

@implementation RoadTransportEmptyListView

- (instancetype)initWithFrame:(CGRect)frame styType:(NSString *)typeStr{
    self = [super initWithFrame: frame];
    if (self) {
        self.strType = typeStr;
        self.daoluyunshuArr = @[@"daoluyunshuzheng1shili",@"daoluyunshuzheng2shili",@"daoluyunshuzheng3shili"];
        self.daoluyunshuNianSArr = @[@"daoluyunshuzhengniansheng1",@"daoluyunshuzhengniansheng2",@"daoluyunshuzhengniansheng3"];
        [self setUI];
    }
    return self;
}
- (void)setUI{
    [self addSubview:self.bottomView];
    [self leftButtonAction];
}
-(UIView *)bottomView{
    if (_bottomView == nil) {
        self.bottomView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, ScreenW, ScreenH)];
        self.bottomView.backgroundColor = [UIColor colorWithRed:0 green:0 blue:0 alpha:0.8];
        [self.bottomView addSubview:self.bgView];
    }
    return _bottomView;
}
-(UIView *)bgView{
    if (_bgView == nil) {
        self.bgView = [[UIView alloc] initWithFrame:CGRectMake((ScreenW - 300)/2, (ScreenH - 543)/2, 300, 543)];
        self.bgView.layer.masksToBounds = YES;
        self.bgView.layer.cornerRadius = 10;
        self.bgView.backgroundColor = [UIColor clearColor];
        [self.bgView addSubview:self.weightView];
        [self.bgView addSubview:self.cententButton];

    }
    return _bgView;
}
-(UIView *)weightView{
    if (_weightView == nil) {
        self.weightView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 300, 459)];
        self.weightView.layer.masksToBounds = YES;
        self.weightView.layer.cornerRadius = 10;
        self.weightView.backgroundColor = [UIColor whiteColor];
        [self.weightView addSubview:self.topImagView];
        [self.weightView addSubview:self.reightLabel];
        [self.weightView addSubview:self.leftButton];
        [self.weightView addSubview:self.centButton];
        [self.weightView addSubview:self.reightButton];
    }
    return _weightView;
}
- (UIImageView *)topImagView{
    if (_topImagView == nil) {
        self.topImagView = [[UIImageView alloc] initWithFrame:CGRectMake(10, 10, 280, 380)];
    }
    return _topImagView;
}
- (UILabel *)reightLabel{
    if (_reightLabel == nil) {
        self.reightLabel = [[UILabel alloc] initWithFrame:CGRectMake(252, -3, 56, 26)];
        self.reightLabel.text = @"示例";
        self.reightLabel.textColor = [UIColor whiteColor];
        self.reightLabel.backgroundColor = Theme_ColorValue;
        self.reightLabel.layer.masksToBounds = YES;
        self.reightLabel.textAlignment = NSTextAlignmentCenter;
        self.reightLabel.layer.cornerRadius = 8;
    }
    return _reightLabel;
}

- (UIButton *)leftButton{
    if (_leftButton == nil) {
        self.leftButton = [UIButton buttonWithType:(UIButtonTypeCustom)];
        self.leftButton.frame = CGRectMake(10, CGRectGetMaxY(self.topImagView.frame) + 10, (300 - 40)/3, 40);
        [self.leftButton setTitle:@"示例1" forState:(UIControlStateNormal)];
        self.leftButton.layer.masksToBounds = YES;
        self.leftButton.layer.cornerRadius = 5;
        self.leftButton.backgroundColor = Theme_ColorValue;
        [self.leftButton addTarget:self action:@selector(leftButtonAction) forControlEvents:(UIControlEventTouchUpInside)];
    }
    return _leftButton;
}
- (UIButton *)centButton{
    if (_centButton == nil) {
        self.centButton = [UIButton buttonWithType:(UIButtonTypeCustom)];
        self.centButton.frame = CGRectMake(CGRectGetMaxX(self.self.leftButton.frame) + 10, CGRectGetMaxY(self.topImagView.frame) + 10, (300 - 40)/3, 40);
        [self.centButton setTitle:@"示例2" forState:(UIControlStateNormal)];
        self.centButton.layer.masksToBounds = YES;
        self.centButton.layer.cornerRadius = 5;
        self.centButton.backgroundColor = Theme_ColorValue;
        [self.centButton addTarget:self action:@selector(centButtonAction) forControlEvents:(UIControlEventTouchUpInside)];

    }
    return _centButton;
}
- (UIButton *)reightButton{
    if (_reightButton == nil) {
        self.reightButton = [UIButton buttonWithType:(UIButtonTypeCustom)];
        self.reightButton.frame = CGRectMake(CGRectGetMaxX(self.self.centButton.frame) + 10, CGRectGetMaxY(self.topImagView.frame) + 10, (300 - 40)/3, 40);
        [self.reightButton setTitle:@"示例3" forState:(UIControlStateNormal)];
        self.reightButton.layer.masksToBounds = YES;
        self.reightButton.layer.cornerRadius = 5;
        self.reightButton.backgroundColor = Theme_ColorValue;
        [self.reightButton addTarget:self action:@selector(reightButtonAction) forControlEvents:(UIControlEventTouchUpInside)];

    }
    return _reightButton;
}
- (UIButton *)cententButton{
    if (_cententButton == nil) {
        self.cententButton = [UIButton buttonWithType:(UIButtonTypeCustom)];
        self.cententButton.frame = CGRectMake((300 - 44)/2, 543 - 64  + 20, 44, 44);
        [self.cententButton setBackgroundImage:[UIImage imageNamed:@"Instagram"] forState:(UIControlStateNormal)];
    }
    return _cententButton;
}
- (void)leftButtonAction{
    [self.leftButton setTitleColor:[UIColor whiteColor] forState:(UIControlStateNormal)];
    self.leftButton.backgroundColor = Theme_ColorValue;
    [self.centButton setTitleColor:[UIColor colorWithRed:162/255.0 green:163/255.0 blue:177/255.0 alpha:1] forState:(UIControlStateNormal)];
    self.centButton.backgroundColor = [UIColor colorWithRed:232/255.0 green:233/255.0 blue:236/255.0 alpha:1];
    [self.reightButton setTitleColor:[UIColor colorWithRed:162/255.0 green:163/255.0 blue:177/255.0 alpha:1] forState:(UIControlStateNormal)];
    self.reightButton.backgroundColor = [UIColor colorWithRed:232/255.0 green:233/255.0 blue:236/255.0 alpha:1];
    if ([self.strType isEqualToString:@"0"]) {
        self.topImagView.image = [UIImage imageNamed:self.daoluyunshuArr.firstObject];
    }else{
        self.topImagView.image = [UIImage imageNamed:self.daoluyunshuNianSArr.firstObject];
    }
}
- (void)centButtonAction{
    [self.centButton setTitleColor:[UIColor whiteColor] forState:(UIControlStateNormal)];
    self.centButton.backgroundColor = Theme_ColorValue;
    [self.leftButton setTitleColor:[UIColor colorWithRed:162/255.0 green:163/255.0 blue:177/255.0 alpha:1] forState:(UIControlStateNormal)];
    self.leftButton.backgroundColor = [UIColor colorWithRed:232/255.0 green:233/255.0 blue:236/255.0 alpha:1];
    [self.reightButton setTitleColor:[UIColor colorWithRed:162/255.0 green:163/255.0 blue:177/255.0 alpha:1] forState:(UIControlStateNormal)];
    self.reightButton.backgroundColor = [UIColor colorWithRed:232/255.0 green:233/255.0 blue:236/255.0 alpha:1];
    if ([self.strType isEqualToString:@"0"]) {
        self.topImagView.image = [UIImage imageNamed:self.daoluyunshuArr[1]];
    }else{
        self.topImagView.image = [UIImage imageNamed:self.daoluyunshuNianSArr[1]];
    }
}
- (void)reightButtonAction{
    [self.reightButton setTitleColor:[UIColor whiteColor] forState:(UIControlStateNormal)];
    self.reightButton.backgroundColor = Theme_ColorValue;
    [self.leftButton setTitleColor:[UIColor colorWithRed:162/255.0 green:163/255.0 blue:177/255.0 alpha:1] forState:(UIControlStateNormal)];
    self.leftButton.backgroundColor = [UIColor colorWithRed:232/255.0 green:233/255.0 blue:236/255.0 alpha:1];
    [self.centButton setTitleColor:[UIColor colorWithRed:162/255.0 green:163/255.0 blue:177/255.0 alpha:1] forState:(UIControlStateNormal)];
    self.centButton.backgroundColor = [UIColor colorWithRed:232/255.0 green:233/255.0 blue:236/255.0 alpha:1];
    if ([self.strType isEqualToString:@"0"]) {
        self.topImagView.image = [UIImage imageNamed:self.daoluyunshuArr.lastObject];
    }else{
        self.topImagView.image = [UIImage imageNamed:self.daoluyunshuNianSArr.lastObject];
    }
}
@end
